package com.mangosteen.interviewji.model.vo;

import cn.hutool.json.JSONUtil;
import com.mangosteen.interviewji.model.entity.QuestionAssociate;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 题目关联视图
 *
 * @author <a href="https://github.com/liyupi">程序员鱼皮</a>
 * @from <a href="https://www.code-nav.cn">编程导航学习圈</a>
 */
@Data
public class QuestionAssociateVO implements Serializable {

    /**
     * 题目id
     */
    private Long questionId;

    /**
     * 浏览量
     */
    private Integer viewNum;

    /**
     * 点赞数
     */
    private Integer thumNum;

    /**
     * 收藏量
     */
    private Integer favourNum;

    /**
     * 优先级
     */
    private Integer priority;

    /**
     * 封装类转对象
     *
     * @param questionAssociateVO
     * @return
     */
    public static QuestionAssociate voToObj(QuestionAssociateVO questionAssociateVO) {
        if (questionAssociateVO == null) {
            return null;
        }
        QuestionAssociate questionAssociate = new QuestionAssociate();
        BeanUtils.copyProperties(questionAssociateVO, questionAssociate);
        return questionAssociate;
    }

    /**
     * 对象转封装类
     *
     * @param questionAssociate
     * @return
     */
    public static QuestionAssociateVO objToVo(QuestionAssociate questionAssociate) {
        if (questionAssociate == null) {
            return null;
        }
        QuestionAssociateVO questionAssociateVO = new QuestionAssociateVO();
        BeanUtils.copyProperties(questionAssociate, questionAssociateVO);
        return questionAssociateVO;
    }
}
